package cms

import (
	"gitcode.com/G-YT/baoyou/server/middleware"
	"github.com/gin-gonic/gin"
)

type ArticleRouter struct{}

// InitArticleRouter 初始化 文章信息 路由信息
func (s *ArticleRouter) InitArticleRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
	articleRouter := Router.Group("article").Use(middleware.OperationRecord())
	articleRouterWithoutRecord := Router.Group("article")
	articleRouterWithoutAuth := PublicRouter.Group("article")
	{
		articleRouter.POST("createArticle", articleApi.CreateArticle)             // 新建文章信息
		articleRouter.DELETE("deleteArticle", articleApi.DeleteArticle)           // 删除文章信息
		articleRouter.DELETE("deleteArticleByIds", articleApi.DeleteArticleByIds) // 批量删除文章信息
		articleRouter.PUT("updateArticle", articleApi.UpdateArticle)              // 更新文章信息
	}
	{
		articleRouterWithoutRecord.GET("getArticleList", articleApi.GetArticleList) // 获取文章信息列表
	}
	{
		articleRouterWithoutAuth.GET("findArticle", articleApi.FindArticle)                   // 根据ID获取文章信息
		articleRouterWithoutAuth.GET("getArticleDataSource", articleApi.GetArticleDataSource) // 获取文章信息数据源
		articleRouterWithoutAuth.GET("getArticlePublic", articleApi.GetArticlePublic)         // 文章信息开放接口
		articleRouterWithoutAuth.GET("getArticleByTag", articleApi.GetArticleByTag)           // 根据tag获取文章
		articleRouterWithoutAuth.GET("getArticleByCategory", articleApi.GetArticleByCategory) // 根据分类获取文章
	}
}
